/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-05-04 09:50:21
 * @LastEditTime : 2023-09-07 19:53:25
 * @LastEditors  : 飞越疯人院 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\FirstLevel\SecurityActivity.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { AddDataButton, ModDataButton, DelDataButton, OpenTwoRouter, OpenSelection } from '../Common/options'

export const SecurityActivityTwo = async ({ url, OptionsEvent, ClientData, Permission, actionRef }) => {
    let data = {
        pageSize: 10,
        params: { pageIndex: 1, dataType: 2 },
        get: API_LIST()[`getSecurityActivityOC`],
        added: `posSecurityActivity`,
        modify: `putSecurityActivity`,
        delete: `delSecurityActivity`,
        hideInSearch: true,
        independenceSet: {
            title: '组织机构',
            url: 'getOrgTree',
            data: { IsByUserUuid: 1 },
            type: 'TableNavTree001',
            all: true,
        },
        independence: 'organizationUuid',
        initialValues: { dataType: 2 },
        options: [
            <AddDataButton OptionsEvent={OptionsEvent} type="primary" icon="add" title="新增" />,
            <OpenSelection
                OptionsEvent={OptionsEvent}
                title="批量删除"
                type="primary"
                danger
                data={{ type: 'SelectionDelete', url: 'posSecurityActivityBatchRemove' }}
            />,
        ],
        columns: [
            commonTableList.uuid,
            {
                title: 'dataType',
                dataIndex: 'dataType',
                search: false,
                valueType: 'hidden',
                hideInTable: true,
            },
            {
                ...commonTableList.organizationUuid,
                valueEnum: ClientData.organization,
                title: '单位',
                width: 300,
                hideInSearch: true,
            },
            { ...commonTableList.tableName, title: '主题' },
            {
                dataIndex: 'startTime',
                title: '日期',
                valueType: 'Date',
                showTime: true,
                ellipsis: true,
                rules: true,
                width: 200,
                hideInSearch: true,
            },
            commonTableList.BeginDate,
            commonTableList.EndDate,
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 120,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        <OpenTwoRouter
                            key="A01"
                            title="附件管理"
                            twoTitle="年度工作计划管理"
                            modal="TableList"
                            OptionsEvent={OptionsEvent}
                            other={{
                                page: 'SecurityActivityAnnexTwo',
                                Permission,
                                oneData: record,
                                header: data.columns,
                            }}
                        />,
                        <ModDataButton OptionsEvent={OptionsEvent} key="modify" title="修改" data={record} />,
                        <DelDataButton
                            OptionsEvent={OptionsEvent}
                            key="del"
                            title="删除"
                            url="SecurityActivity"
                            uuid={record.uuid}
                        />,
                    ]
                },
            },
        ],
    }

    return data
}
